create sequence seq_conn_api start with 1000000 increment by 1;

CREATE TABLE conn_api (
    api_id int NOT NULL DEFAULT seq_conn_api.nextval,
    api_code varchar(32) NOT NULL,
    api_name varchar(64) NOT NULL,
    api_desc varchar(128),
    api_type char(1) NOT NULL DEFAULT '1',
    ws_operation varchar(64),
    app_id varchar(32) NOT NULL,
    alarm_secs int DEFAULT 0,
    timeout_secs int DEFAULT 0,
    retry_times int DEFAULT 0,
    api_status char(1) DEFAULT '1',
    api_master_version varchar(16),
    delete_flag char(1) NOT NULL DEFAULT 'N',
    create_by varchar(64),
    create_time timestamp(6),
    update_by varchar(64),
    update_time timestamp(6),
    CONSTRAINT conn_api_pkey PRIMARY KEY (api_id)
)
;

COMMENT ON COLUMN conn_api.api_id IS 'API主键';
COMMENT ON COLUMN conn_api.api_code IS 'API编码';
COMMENT ON COLUMN conn_api.api_name IS 'API服务名';
COMMENT ON COLUMN conn_api.api_desc IS 'API描述';
COMMENT ON COLUMN conn_api.api_type IS 'API类型[1=WebService,2=Restful,3=JMS]';
COMMENT ON COLUMN conn_api.ws_operation IS 'WebService类型方法';
COMMENT ON COLUMN conn_api.app_id IS '应用系统ID';
COMMENT ON COLUMN conn_api.alarm_secs IS '预警响应时间（秒）';
COMMENT ON COLUMN conn_api.timeout_secs IS '超时时间（秒）';
COMMENT ON COLUMN conn_api.retry_times IS '失败重试次数';
COMMENT ON COLUMN conn_api.api_status IS 'API状态[0=生效,1=暂存,2=停用,9=作废]';
COMMENT ON COLUMN conn_api.api_master_version IS 'API主版本';
COMMENT ON COLUMN conn_api.delete_flag IS '是否删除[Y=是,N=否]';
COMMENT ON COLUMN conn_api.create_by IS '创建者';
COMMENT ON COLUMN conn_api.create_time IS '创建时间';
COMMENT ON COLUMN conn_api.update_by IS '更新者';
COMMENT ON COLUMN conn_api.update_time IS '更新时间';
COMMENT ON TABLE conn_api IS '源服务API';

create sequence seq_conn_api_header_in start with 1000000 increment by 1;

CREATE TABLE conn_api_header_in (
    header_id int NOT NULL DEFAULT seq_conn_api_header_in.nextval,
    api_ver_id bigint NOT NULL,
    api_id bigint NOT NULL,
    api_version varchar(16) NOT NULL,
    node_type varchar(16) NOT NULL DEFAULT 'string',
    node_name varchar(32) NOT NULL,
    node_label varchar(32) NOT NULL,
    node_neededable char(1) NOT NULL DEFAULT 'Y',
    node_valueable char(1) NOT NULL DEFAULT 'Y',
    node_check_regex varchar(128),
    create_by varchar(64),
    create_time timestamp(6),
    update_by varchar(64),
    update_time timestamp(6),
    CONSTRAINT conn_api_header_in_pkey PRIMARY KEY (header_id)
)
;

COMMENT ON COLUMN conn_api_header_in.header_id IS '请求头主键';
COMMENT ON COLUMN conn_api_header_in.api_ver_id IS 'API版本主键';
COMMENT ON COLUMN conn_api_header_in.api_id IS 'API主键';
COMMENT ON COLUMN conn_api_header_in.api_version IS '主版本';
COMMENT ON COLUMN conn_api_header_in.node_type IS '节点类型[string=字符串,long=整数,decimal=小数]';
COMMENT ON COLUMN conn_api_header_in.node_name IS '英文字段名';
COMMENT ON COLUMN conn_api_header_in.node_label IS '字段中文描述';
COMMENT ON COLUMN conn_api_header_in.node_neededable IS '节点是否必须[Y=是,N=否]';
COMMENT ON COLUMN conn_api_header_in.node_valueable IS '节点是否必填[Y=是,N=否]';
COMMENT ON COLUMN conn_api_header_in.node_check_regex IS '字段值校验正则表达式';
COMMENT ON COLUMN conn_api_header_in.create_by IS '创建者';
COMMENT ON COLUMN conn_api_header_in.create_time IS '创建时间';
COMMENT ON COLUMN conn_api_header_in.update_by IS '更新者';
COMMENT ON COLUMN conn_api_header_in.update_time IS '更新时间';
COMMENT ON TABLE conn_api_header_in IS '源服务API请求头';

create sequence seq_conn_api_header_out start with 1000000 increment by 1;

CREATE TABLE conn_api_header_out (
    header_id int NOT NULL DEFAULT seq_conn_api_header_out.nextval,
    api_ver_id bigint,
    api_id bigint NOT NULL,
    api_version varchar(16),
    node_type varchar(16) NOT NULL DEFAULT 'string',
    node_name varchar(32) NOT NULL,
    node_label varchar(32),
    node_neededable varchar(100) NOT NULL DEFAULT 'Y',
    create_by varchar(64),
    create_time timestamp(6),
    update_by varchar(64),
    update_time timestamp(6),
    CONSTRAINT conn_api_header_out_pkey PRIMARY KEY (header_id)
)
;

COMMENT ON COLUMN conn_api_header_out.header_id IS '响应头主键';
COMMENT ON COLUMN conn_api_header_out.api_ver_id IS 'API版本主键';
COMMENT ON COLUMN conn_api_header_out.api_id IS 'API主键';
COMMENT ON COLUMN conn_api_header_out.api_version IS '主版本';
COMMENT ON COLUMN conn_api_header_out.node_type IS '节点类型[string=字符串,long=整数,decimal=小数]';
COMMENT ON COLUMN conn_api_header_out.node_name IS '英文字段名';
COMMENT ON COLUMN conn_api_header_out.node_label IS '字段中文描述';
COMMENT ON COLUMN conn_api_header_out.node_neededable IS '节点是否必须[Y=是,N=否]';
COMMENT ON COLUMN conn_api_header_out.create_by IS '创建者';
COMMENT ON COLUMN conn_api_header_out.create_time IS '创建时间';
COMMENT ON COLUMN conn_api_header_out.update_by IS '更新者';
COMMENT ON COLUMN conn_api_header_out.update_time IS '更新时间';
COMMENT ON TABLE conn_api_header_out IS '源服务API响应头';

create sequence seq_conn_api_param_in start with 1000000 increment by 1;

CREATE TABLE conn_api_param_in (
    node_id int NOT NULL DEFAULT seq_conn_api_param_in.nextval,
    api_ver_id bigint,
    api_id bigint NOT NULL,
    api_version varchar(16),
    node_parent_id bigint NOT NULL,
    node_type varchar(8) NOT NULL DEFAULT 'string',
    node_name varchar(64) NOT NULL,
    node_label varchar(64),
    node_alias varchar(64),
    node_neededable char(1) NOT NULL DEFAULT 'Y',
    node_valueable char(1) NOT NULL DEFAULT 'Y',
    node_check_regex varchar(128),
    is_attr char(1) DEFAULT 'N',
    create_by varchar(64),
    create_time timestamp(6),
    update_by varchar(64),
    update_time timestamp(6),
    CONSTRAINT conn_api_param_in_pkey PRIMARY KEY (node_id)
)
;

COMMENT ON COLUMN conn_api_param_in.node_id IS '节点ID';
COMMENT ON COLUMN conn_api_param_in.api_ver_id IS 'API版本主键';
COMMENT ON COLUMN conn_api_param_in.api_id IS 'API主键';
COMMENT ON COLUMN conn_api_param_in.api_version IS '主版本';
COMMENT ON COLUMN conn_api_param_in.node_parent_id IS '父节点ID';
COMMENT ON COLUMN conn_api_param_in.node_type IS '节点类型[string=字符串,long=整数,decimal=小数,object=对象,array=数组]';
COMMENT ON COLUMN conn_api_param_in.node_name IS '英文字段名';
COMMENT ON COLUMN conn_api_param_in.node_label IS '字段中文描述';
COMMENT ON COLUMN conn_api_param_in.node_alias IS '字段名别名（多个逗号隔开）';
COMMENT ON COLUMN conn_api_param_in.node_neededable IS '节点是否必须[Y=是,N=否]';
COMMENT ON COLUMN conn_api_param_in.node_valueable IS '节点是否必填[Y=是,N=否]';
COMMENT ON COLUMN conn_api_param_in.node_check_regex IS '字段值校验正则表达式';
COMMENT ON COLUMN conn_api_param_in.is_attr IS '节点是否属性[Y=是,N=否]';
COMMENT ON COLUMN conn_api_param_in.create_by IS '创建者';
COMMENT ON COLUMN conn_api_param_in.create_time IS '创建时间';
COMMENT ON COLUMN conn_api_param_in.update_by IS '更新者';
COMMENT ON COLUMN conn_api_param_in.update_time IS '更新时间';
COMMENT ON TABLE conn_api_param_in IS '源服务API入参';

create sequence seq_conn_api_param_out start with 1000000 increment by 1;

CREATE TABLE conn_api_param_out (
    node_id int NOT NULL DEFAULT seq_conn_api_param_out.nextval,
    api_ver_id bigint,
    api_id bigint NOT NULL,
    api_version varchar(16),
    node_parent_id bigint NOT NULL,
    node_type varchar(8) NOT NULL DEFAULT 'string',
    node_name varchar(32) NOT NULL,
    node_label varchar(32),
    node_neededable char(1) NOT NULL DEFAULT 'Y',
    is_attr char(1) DEFAULT 'N',
    is_msg_flag char(1) DEFAULT 'N',
    is_success_flag char(1) DEFAULT 'N',
    success_value varchar(8),
    create_by varchar(64),
    create_time timestamp(6),
    update_by varchar(64),
    update_time timestamp(6),
    CONSTRAINT conn_api_param_out_pkey PRIMARY KEY (node_id)
)
;

COMMENT ON COLUMN conn_api_param_out.node_id IS '节点ID';
COMMENT ON COLUMN conn_api_param_out.api_ver_id IS 'API版本主键';
COMMENT ON COLUMN conn_api_param_out.api_id IS 'API主键';
COMMENT ON COLUMN conn_api_param_out.api_version IS '主版本';
COMMENT ON COLUMN conn_api_param_out.node_parent_id IS '父节点ID';
COMMENT ON COLUMN conn_api_param_out.node_type IS '节点类型[string=字符串,long=整数,decimal=小数,object=对象,array=数组]';
COMMENT ON COLUMN conn_api_param_out.node_name IS '英文字段名';
COMMENT ON COLUMN conn_api_param_out.node_label IS '字段中文描述';
COMMENT ON COLUMN conn_api_param_out.node_neededable IS '节点是否必须[Y=是,N=否]';
COMMENT ON COLUMN conn_api_param_out.is_attr IS '节点是否属性[Y=是,N=否]';
COMMENT ON COLUMN conn_api_param_out.is_msg_flag IS '是否消息标识[Y=是,N=否]';
COMMENT ON COLUMN conn_api_param_out.is_success_flag IS '是否成功标识[Y=是,N=否]';
COMMENT ON COLUMN conn_api_param_out.success_value IS '成功的值';
COMMENT ON COLUMN conn_api_param_out.create_by IS '创建者';
COMMENT ON COLUMN conn_api_param_out.create_time IS '创建时间';
COMMENT ON COLUMN conn_api_param_out.update_by IS '更新者';
COMMENT ON COLUMN conn_api_param_out.update_time IS '更新时间';
COMMENT ON TABLE conn_api_param_out IS '源服务API出参';

create sequence seq_conn_api_version start with 1000000 increment by 1;

CREATE TABLE conn_api_version (
    api_ver_id int NOT NULL DEFAULT seq_conn_api_version.nextval,
    api_id bigint NOT NULL,
    api_version varchar(16),
    api_url varchar(512),
    http_request_method varchar(8),
    api_params_body char(1) DEFAULT '1',
    inparam_with_attr char(1) NOT NULL DEFAULT 'N',
    outparam_with_attr char(1) NOT NULL DEFAULT 'N',
    api_ver_desc varchar(512),
    api_ver_status char(1) DEFAULT '0',
    api_ver_start_time timestamp(6),
    api_ver_end_time timestamp(6),
    wsdl_content_id bigint,
    ws_operation varchar(64),
    wsdl_url_origin char(1) DEFAULT 'Y',
    jms_datasource_code varchar(32),
    jms_type varchar(16),
    jms_destination_name varchar(64),
    jms_role char(1) DEFAULT 'C',
    create_by varchar(64),
    create_time timestamp(6),
    update_by varchar(64),
    update_time timestamp(6),
    CONSTRAINT conn_api_version_pkey PRIMARY KEY (api_ver_id)
)
;

COMMENT ON COLUMN conn_api_version.api_ver_id IS 'API版本主键';
COMMENT ON COLUMN conn_api_version.api_id IS 'API主键';
COMMENT ON COLUMN conn_api_version.api_version IS 'API版本';
COMMENT ON COLUMN conn_api_version.api_url IS 'API服务URL';
COMMENT ON COLUMN conn_api_version.http_request_method IS 'API请求方式[GET=GET,POST=POST]';
COMMENT ON COLUMN conn_api_version.api_params_body IS '参数体类型[1=Raw,2=FormData]';
COMMENT ON COLUMN conn_api_version.inparam_with_attr IS '带属性入参[Y=是,N=否]';
COMMENT ON COLUMN conn_api_version.outparam_with_attr IS '带属性出参[Y=是,N=否]';
COMMENT ON COLUMN conn_api_version.api_ver_desc IS 'API版本说明';
COMMENT ON COLUMN conn_api_version.api_ver_status IS 'API版本状态[0=生效,1=暂存,2=停用,9=作废]';
COMMENT ON COLUMN conn_api_version.api_ver_start_time IS '版本启用时间';
COMMENT ON COLUMN conn_api_version.api_ver_end_time IS '版本停用时间（根据启停时间定时更新版本状态）';
COMMENT ON COLUMN conn_api_version.wsdl_content_id IS 'WSDL内容主键';
COMMENT ON COLUMN conn_api_version.ws_operation IS 'WebService类型方法';
COMMENT ON COLUMN conn_api_version.wsdl_url_origin IS 'WSDL来源URL[Y=是,N=否]';
COMMENT ON COLUMN conn_api_version.jms_datasource_code IS 'JMS数据源编码';
COMMENT ON COLUMN conn_api_version.jms_type IS 'JMS类型[topic=Topic,queue=Queue]';
COMMENT ON COLUMN conn_api_version.jms_destination_name IS 'JMS消息目标名称';
COMMENT ON COLUMN conn_api_version.jms_role IS 'JMS角色[P=生产者,C=消费者]';
COMMENT ON COLUMN conn_api_version.create_by IS '创建者';
COMMENT ON COLUMN conn_api_version.create_time IS '创建时间';
COMMENT ON COLUMN conn_api_version.update_by IS '更新者';
COMMENT ON COLUMN conn_api_version.update_time IS '更新时间';
COMMENT ON TABLE conn_api_version IS '源服务API版本';

create sequence seq_conn_app_sign_service start with 1000000 increment by 1;

CREATE TABLE conn_app_sign_service (
    sign_id bigint NOT NULL, -- 签约id
    app_id varchar(32) NOT NULL, -- 应用系统id
    service_id bigint NOT NULL, -- 服务id
    order_explain varchar(512) DEFAULT '', -- 订购说明
    sign_status char(1) DEFAULT '0' NOT NULL, -- 签约状态[0=生效,1=暂存,2=停用,7=驳回,8=审批中,9=作废]
    service_start_time timestamp(6) NULL, -- 生效时间
    service_end_time timestamp(6) NULL, -- 过期时间（根据时间定时更新签约状态）
    service_version varchar(16) DEFAULT '', -- 签约服务版本（能力服务升级时需手动选择升级版本）
    create_by varchar(64) DEFAULT '', -- 创建者
    create_time timestamp(6) NULL, -- 创建时间
    update_by varchar(64) DEFAULT '', -- 更新者
    update_time timestamp(6) NULL, -- 更新时间
    CONSTRAINT conn_app_sign_service_pkey PRIMARY KEY (sign_id)
);
COMMENT ON TABLE conn_app_sign_service IS '应用签约能力服务';

COMMENT ON COLUMN conn_app_sign_service.sign_id IS '签约id';
COMMENT ON COLUMN conn_app_sign_service.app_id IS '应用系统id';
COMMENT ON COLUMN conn_app_sign_service.service_id IS '服务id';
COMMENT ON COLUMN conn_app_sign_service.order_explain IS '订购说明';
COMMENT ON COLUMN conn_app_sign_service.sign_status IS '签约状态[0=生效,1=暂存,2=停用,7=驳回,8=审批中,9=作废]';
COMMENT ON COLUMN conn_app_sign_service.service_start_time IS '生效时间';
COMMENT ON COLUMN conn_app_sign_service.service_end_time IS '过期时间（根据时间定时更新签约状态）';
COMMENT ON COLUMN conn_app_sign_service.service_version IS '签约服务版本（能力服务升级时需手动选择升级版本）';
COMMENT ON COLUMN conn_app_sign_service.create_by IS '创建者';
COMMENT ON COLUMN conn_app_sign_service.create_time IS '创建时间';
COMMENT ON COLUMN conn_app_sign_service.update_by IS '更新者';
COMMENT ON COLUMN conn_app_sign_service.update_time IS '更新时间';

create sequence seq_conn_change_header_in start with 1000000 increment by 1;

CREATE TABLE conn_change_header_in (
    change_id bigint NOT NULL, -- 唯一标准
    service_ver_id bigint NOT NULL, -- 服务版本主键
    api_header_id bigint NOT NULL, -- api请求头主键
    api_ver_id bigint NOT NULL, -- api版本主键
    json_path varchar(128) DEFAULT '', -- 映射请求jsonpath路径
    CONSTRAINT conn_change_header_in_pkey PRIMARY KEY (change_id)
);
COMMENT ON TABLE conn_change_header_in IS '能力服务与api请求参数结构转换';

COMMENT ON COLUMN conn_change_header_in.change_id IS '唯一标准';
COMMENT ON COLUMN conn_change_header_in.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_change_header_in.api_header_id IS 'api请求头主键';
COMMENT ON COLUMN conn_change_header_in.api_ver_id IS 'api版本主键';
COMMENT ON COLUMN conn_change_header_in.json_path IS '映射请求jsonpath路径';

create sequence seq_conn_change_header_out start with 1000000 increment by 1;

CREATE TABLE conn_change_header_out (
    change_id bigint NOT NULL, -- 唯一标准
    service_header_id bigint NOT NULL, -- 服务响应头主键
    service_ver_id bigint NOT NULL, -- 服务版本主键
    api_ver_id bigint NOT NULL, -- api版本主键
    json_path varchar(128) DEFAULT '', -- 映射请求jsonpath路径
    CONSTRAINT conn_change_header_out_pkey PRIMARY KEY (change_id)
);
COMMENT ON TABLE conn_change_header_out IS 'api与能力服务响应参数结构转换';

COMMENT ON COLUMN conn_change_header_out.change_id IS '唯一标准';
COMMENT ON COLUMN conn_change_header_out.service_header_id IS '服务响应头主键';
COMMENT ON COLUMN conn_change_header_out.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_change_header_out.api_ver_id IS 'api版本主键';
COMMENT ON COLUMN conn_change_header_out.json_path IS '映射请求jsonpath路径';

create sequence seq_conn_change_param_in start with 1000000 increment by 1;

CREATE TABLE conn_change_param_in (
    change_id bigint NOT NULL, -- 唯一标准
    service_ver_id bigint NOT NULL, -- 服务版本主键
    api_node_id bigint NOT NULL, -- api节点id
    api_ver_id bigint NOT NULL, -- api版本主键
    json_path varchar(128) DEFAULT '', -- 映射请求jsonpath路径
    CONSTRAINT conn_change_param_in_pkey PRIMARY KEY (change_id)
);
COMMENT ON TABLE conn_change_param_in IS '能力服务与api入参结构转换';

COMMENT ON COLUMN conn_change_param_in.change_id IS '唯一标准';
COMMENT ON COLUMN conn_change_param_in.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_change_param_in.api_node_id IS 'api节点id';
COMMENT ON COLUMN conn_change_param_in.api_ver_id IS 'api版本主键';
COMMENT ON COLUMN conn_change_param_in.json_path IS '映射请求jsonpath路径';

create sequence seq_conn_change_param_out start with 1000000 increment by 1;

CREATE TABLE conn_change_param_out (
    change_id bigint NOT NULL, -- 唯一标准
    service_node_id bigint NOT NULL, -- 服务节点id
    service_ver_id bigint NULL, -- 服务版本主键
    api_ver_id bigint NOT NULL, -- api版本主键
    json_path varchar(128) DEFAULT '', -- 映射请求jsonpath路径
    CONSTRAINT conn_change_param_out_pkey PRIMARY KEY (change_id)
);
COMMENT ON TABLE conn_change_param_out IS 'api与能力服务输出参数结构转换';

COMMENT ON COLUMN conn_change_param_out.change_id IS '唯一标准';
COMMENT ON COLUMN conn_change_param_out.service_node_id IS '服务节点id';
COMMENT ON COLUMN conn_change_param_out.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_change_param_out.api_ver_id IS 'api版本主键';
COMMENT ON COLUMN conn_change_param_out.json_path IS '映射请求jsonpath路径';

create sequence seq_conn_content start with 1000000 increment by 1;

CREATE TABLE conn_content (
    content_id bigint NOT NULL, -- 内容主键
    content_text text NOT NULL, -- 内容
    content_type varchar(8) NOT NULL, -- 内容类型[route=路由,wsdl=wsdl,orches=编排]
    md5 varchar(32) NULL, -- md5值
    CONSTRAINT conn_content_pkey PRIMARY KEY (content_id)
);
COMMENT ON TABLE conn_content IS '内容表';

COMMENT ON COLUMN conn_content.content_id IS '内容主键';
COMMENT ON COLUMN conn_content.content_text IS '内容';
COMMENT ON COLUMN conn_content.content_type IS '内容类型[route=路由,wsdl=wsdl,orches=编排]';
COMMENT ON COLUMN conn_content.md5 IS 'md5值';

CREATE TABLE conn_jms_datasource (
    jms_code varchar(32) NOT NULL, -- jms数据源编码
    jms_name varchar(32) NOT NULL, -- jms数据源名称
    jms_desc varchar(128) DEFAULT '', -- jms数据源描述
    jms_host varchar(64) NOT NULL, -- 主机地址
    jms_port int NOT NULL, -- 端口号
    jms_username varchar(128) DEFAULT '', -- 用户名
    jms_password varchar(128) DEFAULT '', -- 密码
    is_enable char(1) DEFAULT 'Y' NOT NULL, -- 是否启用[y=启用,n=禁用]
    create_by varchar(64) DEFAULT '', -- 创建人
    create_time timestamp(6) NULL, -- 创建时间
    update_by varchar(64) DEFAULT '', -- 更新人
    update_time timestamp(6) NULL, -- 更新时间
    remark varchar(256) DEFAULT '', -- 备注
    CONSTRAINT conn_jms_datasource_pkey PRIMARY KEY (jms_code)
);
COMMENT ON TABLE conn_jms_datasource IS 'jms数据源';

COMMENT ON COLUMN conn_jms_datasource.jms_code IS 'jms数据源编码';
COMMENT ON COLUMN conn_jms_datasource.jms_name IS 'jms数据源名称';
COMMENT ON COLUMN conn_jms_datasource.jms_desc IS 'jms数据源描述';
COMMENT ON COLUMN conn_jms_datasource.jms_host IS '主机地址';
COMMENT ON COLUMN conn_jms_datasource.jms_port IS '端口号';
COMMENT ON COLUMN conn_jms_datasource.jms_username IS '用户名';
COMMENT ON COLUMN conn_jms_datasource.jms_password IS '密码';
COMMENT ON COLUMN conn_jms_datasource.is_enable IS '是否启用[y=启用,n=禁用]';
COMMENT ON COLUMN conn_jms_datasource.create_by IS '创建人';
COMMENT ON COLUMN conn_jms_datasource.create_time IS '创建时间';
COMMENT ON COLUMN conn_jms_datasource.update_by IS '更新人';
COMMENT ON COLUMN conn_jms_datasource.update_time IS '更新时间';
COMMENT ON COLUMN conn_jms_datasource.remark IS '备注';

create sequence seq_conn_north_intf_log start with 1000000 increment by 1;

CREATE TABLE conn_north_intf_log (
    north_intf_log_id bigint NOT NULL, -- 主键id
    service_code varchar(64) NULL, -- 接口编码
    biz_code varchar(64) NULL, -- 业务编码
    ws_method_name varchar(64) NULL, -- webservice方法名
    north_in_params text NULL, -- 北向发送的接口参数
    producer_retrun_msg text NULL, -- 开放互联生产者接口返回的信息
    status char(1) DEFAULT '0' NULL, -- 状态[0=已接收,1=已发送,2=下发成功,3=下发失败]
    num int NULL, -- 重推次数
    out_params text NULL, -- 开放互联消费者转换后下发的参数
    js_retrun_msg text NULL, -- 江苏综调接口返回的信息
    north_time timestamp(6) NULL, -- 北向调用接口平台时间
    invoke_js_time timestamp(6) NULL, -- 接口平台调用江苏综调系统接口时间
    invoke_mode char(1) DEFAULT '3' NULL, -- 调用方式[1=透传,3=转换]
    error_msg text NULL, -- 错误信息
    CONSTRAINT conn_north_intf_log_pkey PRIMARY KEY (north_intf_log_id)
);
COMMENT ON TABLE conn_north_intf_log IS '北向调用：接口日志表';

COMMENT ON COLUMN conn_north_intf_log.north_intf_log_id IS '主键id';
COMMENT ON COLUMN conn_north_intf_log.service_code IS '接口编码';
COMMENT ON COLUMN conn_north_intf_log.biz_code IS '业务编码';
COMMENT ON COLUMN conn_north_intf_log.ws_method_name IS 'webservice方法名';
COMMENT ON COLUMN conn_north_intf_log.north_in_params IS '北向发送的接口参数';
COMMENT ON COLUMN conn_north_intf_log.producer_retrun_msg IS '开放互联生产者接口返回的信息';
COMMENT ON COLUMN conn_north_intf_log.status IS '状态[0=已接收,1=已发送,2=下发成功,3=下发失败]';
COMMENT ON COLUMN conn_north_intf_log.num IS '重推次数';
COMMENT ON COLUMN conn_north_intf_log.out_params IS '开放互联消费者转换后下发的参数';
COMMENT ON COLUMN conn_north_intf_log.js_retrun_msg IS '江苏综调接口返回的信息';
COMMENT ON COLUMN conn_north_intf_log.north_time IS '北向调用接口平台时间';
COMMENT ON COLUMN conn_north_intf_log.invoke_js_time IS '接口平台调用江苏综调系统接口时间';
COMMENT ON COLUMN conn_north_intf_log.invoke_mode IS '调用方式[1=透传,3=转换]';
COMMENT ON COLUMN conn_north_intf_log.error_msg IS '错误信息';

create sequence seq_conn_param_map_in start with 1000000 increment by 1;

CREATE TABLE conn_param_map_in (
    map_id bigint NOT NULL, -- 映射id
    service_node_id bigint NOT NULL, -- 服务节点id
    service_ver_id bigint NOT NULL, -- 服务版本主键
    service_id bigint NOT NULL, -- 服务id
    service_version varchar(16) DEFAULT '' NOT NULL, -- 服务版本
    service_node_name varchar(32) DEFAULT '' NOT NULL, -- 服务节点英文名
    api_node_id bigint NOT NULL, -- api节点id
    api_ver_id bigint NOT NULL, -- api版本主键
    api_id bigint NOT NULL, -- api主键
    api_version varchar(16) DEFAULT '' NOT NULL, -- 主版本
    api_node_ishided char(1) DEFAULT 'N' NOT NULL, -- 是否隐藏[y=是,n=否]
    CONSTRAINT conn_param_map_in_pkey PRIMARY KEY (map_id)
);
COMMENT ON TABLE conn_param_map_in IS '能力服务与api入参映射（记录api和service中全部节点）';

COMMENT ON COLUMN conn_param_map_in.map_id IS '映射id';
COMMENT ON COLUMN conn_param_map_in.service_node_id IS '服务节点id';
COMMENT ON COLUMN conn_param_map_in.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_param_map_in.service_id IS '服务id';
COMMENT ON COLUMN conn_param_map_in.service_version IS '服务版本';
COMMENT ON COLUMN conn_param_map_in.service_node_name IS '服务节点英文名';
COMMENT ON COLUMN conn_param_map_in.api_node_id IS 'api节点id';
COMMENT ON COLUMN conn_param_map_in.api_ver_id IS 'api版本主键';
COMMENT ON COLUMN conn_param_map_in.api_id IS 'api主键';
COMMENT ON COLUMN conn_param_map_in.api_version IS '主版本';
COMMENT ON COLUMN conn_param_map_in.api_node_ishided IS '是否隐藏[y=是,n=否]';

create sequence seq_conn_param_map_out start with 1000000 increment by 1;

CREATE TABLE conn_param_map_out (
    map_id bigint NOT NULL, -- 映射id
    service_node_id bigint NOT NULL, -- 服务节点id
    service_ver_id bigint NOT NULL, -- 服务版本主键
    service_id bigint NOT NULL, -- 服务id
    service_version varchar(16) DEFAULT '' NOT NULL, -- 服务版本
    service_node_name varchar(32) DEFAULT '' NOT NULL, -- 服务节点英文名
    api_node_id bigint NULL, -- api节点id（计算生成的新字段为空）
    api_ver_id bigint NOT NULL, -- api版本主键
    api_id bigint NOT NULL, -- api主键
    api_version varchar(16) DEFAULT '' NOT NULL, -- 主版本
    api_field_expression varchar(128) DEFAULT '', -- api字段运算表达式
    api_node_ishided char(1) DEFAULT 'N' NOT NULL, -- 是否隐藏[y=是,n=否]
    CONSTRAINT conn_param_map_out_pkey PRIMARY KEY (map_id)
);
COMMENT ON TABLE conn_param_map_out IS '能力服务与api出参映射（记录api和service中全部节点）';

COMMENT ON COLUMN conn_param_map_out.map_id IS '映射id';
COMMENT ON COLUMN conn_param_map_out.service_node_id IS '服务节点id';
COMMENT ON COLUMN conn_param_map_out.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_param_map_out.service_id IS '服务id';
COMMENT ON COLUMN conn_param_map_out.service_version IS '服务版本';
COMMENT ON COLUMN conn_param_map_out.service_node_name IS '服务节点英文名';
COMMENT ON COLUMN conn_param_map_out.api_node_id IS 'api节点id（计算生成的新字段为空）';
COMMENT ON COLUMN conn_param_map_out.api_ver_id IS 'api版本主键';
COMMENT ON COLUMN conn_param_map_out.api_id IS 'api主键';
COMMENT ON COLUMN conn_param_map_out.api_version IS '主版本';
COMMENT ON COLUMN conn_param_map_out.api_field_expression IS 'api字段运算表达式';
COMMENT ON COLUMN conn_param_map_out.api_node_ishided IS '是否隐藏[y=是,n=否]';

create sequence seq_conn_script start with 1000000 increment by 1;

CREATE TABLE conn_script (
    id bigint NOT NULL, -- 主键
    app_id varchar(64) NULL, -- 应用id
    script_context text NULL, -- 脚本内容
    script_package_name varchar(255) NULL, -- 脚本包名
    script_class_name varchar(255) NULL, -- 脚本类名
    main_method varchar(255) NULL, -- 脚本入口函数
    conn_content_id text NULL, -- 路由内容表id
    script_type int NULL, -- 脚本类型1java2script3python
    is_deleted int NULL, -- 是否删除
    create_by varchar(255) NULL, -- 创建者
    create_time timestamp(6) NULL, -- 创建时间
    update_by varchar(255) NULL, -- 修改者
    update_time timestamp(6) NULL, -- 修改时间
    CONSTRAINT conn_script_pkey PRIMARY KEY (id)
);
CREATE INDEX app_id_index ON conn_script(app_id);
CREATE INDEX is_deleted_index ON conn_script(is_deleted);
CREATE INDEX package_name_and_class_index ON conn_script(script_package_name, script_class_name);
CREATE INDEX script_type_index ON conn_script(script_type);

COMMENT ON COLUMN conn_script.id IS '主键';
COMMENT ON COLUMN conn_script.app_id IS '应用id';
COMMENT ON COLUMN conn_script.script_context IS '脚本内容';
COMMENT ON COLUMN conn_script.script_package_name IS '脚本包名';
COMMENT ON COLUMN conn_script.script_class_name IS '脚本类名';
COMMENT ON COLUMN conn_script.main_method IS '脚本入口函数';
COMMENT ON COLUMN conn_script.conn_content_id IS '路由内容表id';
COMMENT ON COLUMN conn_script.script_type IS '脚本类型1java2script3python';
COMMENT ON COLUMN conn_script.is_deleted IS '是否删除';
COMMENT ON COLUMN conn_script.create_by IS '创建者';
COMMENT ON COLUMN conn_script.create_time IS '创建时间';
COMMENT ON COLUMN conn_script.update_by IS '修改者';
COMMENT ON COLUMN conn_script.update_time IS '修改时间';

CREATE TABLE conn_serv_type_dataset (
    service_ver_id bigint NOT NULL, -- 服务版本主键
    dataset_id bigint NOT NULL, -- 数据集id
    CONSTRAINT conn_serv_type_dataset_pkey PRIMARY KEY (service_ver_id)
);
COMMENT ON TABLE conn_serv_type_dataset IS '能力服务数据接口';

COMMENT ON COLUMN conn_serv_type_dataset.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_serv_type_dataset.dataset_id IS '数据集id';

CREATE TABLE conn_serv_type_direct (
    service_ver_id bigint NOT NULL, -- 服务版本主键
    api_ver_id bigint NULL, -- api版本主键
    api_id bigint NOT NULL, -- api主键
    api_version varchar(16) DEFAULT '', -- 主版本
    CONSTRAINT conn_serv_type_direct_pkey PRIMARY KEY (service_ver_id)
);
COMMENT ON TABLE conn_serv_type_direct IS '能力服务直连接口';

COMMENT ON COLUMN conn_serv_type_direct.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_serv_type_direct.api_ver_id IS 'api版本主键';
COMMENT ON COLUMN conn_serv_type_direct.api_id IS 'api主键';
COMMENT ON COLUMN conn_serv_type_direct.api_version IS '主版本';

CREATE TABLE conn_serv_type_expert (
    service_ver_id bigint NOT NULL, -- 服务版本主键
    expert_dsl_content_id bigint NOT NULL, -- camel编排dsl内容id
    CONSTRAINT conn_serv_type_expert_pkey PRIMARY KEY (service_ver_id)
);
COMMENT ON TABLE conn_serv_type_expert IS '能力专家模式接口';

COMMENT ON COLUMN conn_serv_type_expert.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_serv_type_expert.expert_dsl_content_id IS 'camel编排dsl内容id';

CREATE TABLE conn_serv_type_orchestration (
    service_ver_id bigint NOT NULL, -- 服务版本主键
    orchestration_dsl_content_id bigint NOT NULL, -- camel编排dsl内容id
    CONSTRAINT conn_serv_type_orchestration_pkey PRIMARY KEY (service_ver_id)
);
COMMENT ON TABLE conn_serv_type_orchestration IS '能力服务编排接口';

COMMENT ON COLUMN conn_serv_type_orchestration.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_serv_type_orchestration.orchestration_dsl_content_id IS 'camel编排dsl内容id';

CREATE TABLE conn_serv_type_protocol (
    service_ver_id bigint NOT NULL, -- 服务版本主键
    api_ver_id bigint NULL, -- api版本主键
    api_id bigint NOT NULL, -- api主键
    api_version varchar(16) DEFAULT '', -- 主版本
    is_param_serialize char(1) DEFAULT 'N' NULL, -- 出入参序列化[y=是,n=否]
    is_param_in_serialize char(1) DEFAULT 'N' NULL, -- 入参序列化[y=是,n=否]
    is_param_out_serialize char(1) DEFAULT 'N' NULL, -- 出参序列化[y=是,n=否]
    param_serialize_type char(1) DEFAULT '1' NULL, -- 出入参序列化类型[1=xml,2=json]
    param_in_serialize_type char(1) DEFAULT '' NULL, -- 入参序列化类型[1=xml,2=json]
    param_out_serialize_type char(1) DEFAULT '' NULL, -- 出参序列化类型[1=xml,2=json]
    param_in_serialize_name varchar(32) DEFAULT '', -- 入参序列化名称
    param_out_serialize_name varchar(32) DEFAULT '', -- 出参序列化名称
    is_header_in_change char(1) DEFAULT 'N' NULL, -- 请求头结构转换[y=是,n=否]
    is_header_out_change char(1) DEFAULT 'N' NULL, -- 响应头结构转换[y=是,n=否]
    is_param_in_change char(1) DEFAULT 'N' NULL, -- 输入参数结构转换[y=是,n=否]
    is_param_out_change char(1) DEFAULT 'N' NULL, -- 输出参数结构转换[y=是,n=否]
    CONSTRAINT conn_serv_type_protocol_pkey PRIMARY KEY (service_ver_id)
);
COMMENT ON TABLE conn_serv_type_protocol IS '能力服务协议转换接口（包含结构和协议转换）';

COMMENT ON COLUMN conn_serv_type_protocol.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_serv_type_protocol.api_ver_id IS 'api版本主键';
COMMENT ON COLUMN conn_serv_type_protocol.api_id IS 'api主键';
COMMENT ON COLUMN conn_serv_type_protocol.api_version IS '主版本';
COMMENT ON COLUMN conn_serv_type_protocol.is_param_serialize IS '出入参序列化[y=是,n=否]';
COMMENT ON COLUMN conn_serv_type_protocol.is_param_in_serialize IS '入参序列化[y=是,n=否]';
COMMENT ON COLUMN conn_serv_type_protocol.is_param_out_serialize IS '出参序列化[y=是,n=否]';
COMMENT ON COLUMN conn_serv_type_protocol.param_serialize_type IS '出入参序列化类型[1=xml,2=json]';
COMMENT ON COLUMN conn_serv_type_protocol.param_in_serialize_type IS '入参序列化类型[1=xml,2=json]';
COMMENT ON COLUMN conn_serv_type_protocol.param_out_serialize_type IS '出参序列化类型[1=xml,2=json]';
COMMENT ON COLUMN conn_serv_type_protocol.param_in_serialize_name IS '入参序列化名称';
COMMENT ON COLUMN conn_serv_type_protocol.param_out_serialize_name IS '出参序列化名称';
COMMENT ON COLUMN conn_serv_type_protocol.is_header_in_change IS '请求头结构转换[y=是,n=否]';
COMMENT ON COLUMN conn_serv_type_protocol.is_header_out_change IS '响应头结构转换[y=是,n=否]';
COMMENT ON COLUMN conn_serv_type_protocol.is_param_in_change IS '输入参数结构转换[y=是,n=否]';
COMMENT ON COLUMN conn_serv_type_protocol.is_param_out_change IS '输出参数结构转换[y=是,n=否]';

CREATE TABLE conn_serv_type_script (
    service_ver_id bigint NOT NULL, -- 服务版本主键
    script_id bigint NOT NULL, -- 脚本主键id
    CONSTRAINT conn_serv_type_script_pkey PRIMARY KEY (service_ver_id)
);
CREATE INDEX script_id_index ON conn_serv_type_script(script_id);
CREATE INDEX service_ver_id_index ON conn_serv_type_script(service_ver_id);
COMMENT ON TABLE conn_serv_type_script IS '能力服务脚本接口';

COMMENT ON COLUMN conn_serv_type_script.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_serv_type_script.script_id IS '脚本主键id';

create sequence seq_conn_service start with 1000000 increment by 1;

CREATE TABLE conn_service (
    service_id bigint NOT NULL, -- 服务id
    service_code varchar(32) NOT NULL, -- 能力服务编码
    service_name varchar(64) NOT NULL, -- 能力服务名
    service_path varchar(64) DEFAULT '' NOT NULL, -- 服务请求短路径
    cate_id bigint NOT NULL, -- 分类id
    service_desc varchar(128) DEFAULT '', -- 描述
    service_type char(1) DEFAULT '1' NULL, -- 能力类型[1=webservice,2=restful,3=jms]
    server_release_type char(1) NULL, -- 能力注册方式[1=api直连,2=复合编排,3=协议转换,4=数据接口,9=专家模式]
    mock_url varchar(512) DEFAULT '', -- mock服务url
    mock_endpoint varchar(64) DEFAULT '', -- mock服务endpoint
    mock_service_name varchar(64) DEFAULT '', -- mock服务servicename
    mock_port_name varchar(64) DEFAULT '', -- mock服务portname
    mock_operation varchar(64) DEFAULT '', -- mock服务method
    limit_ctrl_status char(1) DEFAULT '1' NULL, -- 限流开关[0=正常,2=停用]
    limit_ctrl_type char(1) DEFAULT '1' NULL, -- 限流方式[1=qps,2=线程数]
    limit_ctrl_paramval int DEFAULT 100 NULL, -- 限流阀值
    alarm_secs int DEFAULT 0 NULL, -- 预警响应时间（秒）
    timeout_secs int DEFAULT 0 NULL, -- 超时时间（秒）
    service_status char(1) DEFAULT '1' NULL, -- 服务状态[0=生效,1=暂存,2=停用,7=驳回,8=审批中,9=作废]
    service_master_version varchar(16) DEFAULT '', -- 服务主版本
    delete_flag char(1) DEFAULT 'N' NOT NULL, -- 是否删除[y=是,n=否]
    create_by varchar(64) NULL, -- 创建者
    create_time timestamp(6) NULL, -- 创建时间
    update_by varchar(64) DEFAULT '', -- 更新者
    update_time timestamp(6) NULL, -- 更新时间
    route_content_id bigint NULL, -- 路由内容主键
    CONSTRAINT conn_service_pkey PRIMARY KEY (service_id)
);
CREATE INDEX idx_conn_service ON conn_service(service_code);
COMMENT ON TABLE conn_service IS '能力服务接口';

COMMENT ON COLUMN conn_service.service_id IS '服务id';
COMMENT ON COLUMN conn_service.service_code IS '能力服务编码';
COMMENT ON COLUMN conn_service.service_name IS '能力服务名';
COMMENT ON COLUMN conn_service.service_path IS '服务请求短路径';
COMMENT ON COLUMN conn_service.cate_id IS '分类id';
COMMENT ON COLUMN conn_service.service_desc IS '描述';
COMMENT ON COLUMN conn_service.service_type IS '能力类型[1=webservice,2=restful,3=jms]';
COMMENT ON COLUMN conn_service.server_release_type IS '能力注册方式[1=api直连,2=复合编排,3=协议转换,4=数据接口,9=专家模式]';
COMMENT ON COLUMN conn_service.mock_url IS 'mock服务url';
COMMENT ON COLUMN conn_service.mock_endpoint IS 'mock服务endpoint';
COMMENT ON COLUMN conn_service.mock_service_name IS 'mock服务servicename';
COMMENT ON COLUMN conn_service.mock_port_name IS 'mock服务portname';
COMMENT ON COLUMN conn_service.mock_operation IS 'mock服务method';
COMMENT ON COLUMN conn_service.limit_ctrl_status IS '限流开关[0=正常,2=停用]';
COMMENT ON COLUMN conn_service.limit_ctrl_type IS '限流方式[1=qps,2=线程数]';
COMMENT ON COLUMN conn_service.limit_ctrl_paramval IS '限流阀值';
COMMENT ON COLUMN conn_service.alarm_secs IS '预警响应时间（秒）';
COMMENT ON COLUMN conn_service.timeout_secs IS '超时时间（秒）';
COMMENT ON COLUMN conn_service.service_status IS '服务状态[0=生效,1=暂存,2=停用,7=驳回,8=审批中,9=作废]';
COMMENT ON COLUMN conn_service.service_master_version IS '服务主版本';
COMMENT ON COLUMN conn_service.delete_flag IS '是否删除[y=是,n=否]';
COMMENT ON COLUMN conn_service.create_by IS '创建者';
COMMENT ON COLUMN conn_service.create_time IS '创建时间';
COMMENT ON COLUMN conn_service.update_by IS '更新者';
COMMENT ON COLUMN conn_service.update_time IS '更新时间';
COMMENT ON COLUMN conn_service.route_content_id IS '路由内容主键';

create sequence seq_conn_service_header_in start with 1000000 increment by 1;

CREATE TABLE conn_service_header_in (
    header_id bigint NOT NULL, -- 请求头主键
    service_ver_id bigint NULL, -- 服务版本主键
    service_id bigint NULL, -- 服务id
    service_version varchar(16) DEFAULT '', -- 服务版本
    node_type varchar(16) DEFAULT 'string' NOT NULL, -- 节点类型[string=字符串,long=整数,decimal=小数]
    node_name varchar(32) DEFAULT '' NOT NULL, -- 英文字段名
    node_label varchar(32) NULL, -- 字段中文描述
    node_neededable varchar(100) DEFAULT 'Y' NOT NULL, -- 节点是否必填[y=是,n=否]
    node_valueable char(1) DEFAULT 'Y' NOT NULL, -- 节点是否必填[y=是,n=否]
    node_check_regex varchar(128) DEFAULT '', -- 字段值校验正则表达式
    node_data varchar(2048) NULL,
    create_by varchar(64) DEFAULT '', -- 创建者
    create_time timestamp(6) NULL, -- 创建时间
    update_by varchar(64) DEFAULT '', -- 更新者
    update_time timestamp(6) NULL, -- 更新时间
    CONSTRAINT conn_service_header_in_pkey PRIMARY KEY (header_id)
);
COMMENT ON TABLE conn_service_header_in IS '能力服务请求头';

COMMENT ON COLUMN conn_service_header_in.header_id IS '请求头主键';
COMMENT ON COLUMN conn_service_header_in.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_service_header_in.service_id IS '服务id';
COMMENT ON COLUMN conn_service_header_in.service_version IS '服务版本';
COMMENT ON COLUMN conn_service_header_in.node_type IS '节点类型[string=字符串,long=整数,decimal=小数]';
COMMENT ON COLUMN conn_service_header_in.node_name IS '英文字段名';
COMMENT ON COLUMN conn_service_header_in.node_label IS '字段中文描述';
COMMENT ON COLUMN conn_service_header_in.node_neededable IS '节点是否必填[y=是,n=否]';
COMMENT ON COLUMN conn_service_header_in.node_valueable IS '节点是否必填[y=是,n=否]';
COMMENT ON COLUMN conn_service_header_in.node_check_regex IS '字段值校验正则表达式';
COMMENT ON COLUMN conn_service_header_in.node_data IS '测试值';
COMMENT ON COLUMN conn_service_header_in.create_by IS '创建者';
COMMENT ON COLUMN conn_service_header_in.create_time IS '创建时间';
COMMENT ON COLUMN conn_service_header_in.update_by IS '更新者';
COMMENT ON COLUMN conn_service_header_in.update_time IS '更新时间';

create sequence seq_conn_service_header_out start with 1000000 increment by 1;

CREATE TABLE conn_service_header_out (
    header_id bigint NOT NULL, -- 响应头主键
    service_ver_id bigint NULL, -- 服务版本主键
    service_id bigint NOT NULL, -- 服务id
    service_version varchar(16) DEFAULT '', -- 服务版本
    node_type varchar(16) DEFAULT 'string' NOT NULL, -- 节点类型[string=字符串,long=整数,decimal=小数]
    node_name varchar(32) DEFAULT '' NOT NULL, -- 英文字段名
    node_label varchar(32) NULL, -- 字段中文描述
    node_neededable varchar(100) DEFAULT 'Y' NOT NULL, -- 节点是否必填[y=是,n=否]
    create_by varchar(64) DEFAULT '', -- 创建者
    create_time timestamp(6) NULL, -- 创建时间
    update_by varchar(64) DEFAULT '', -- 更新者
    update_time timestamp(6) NULL, -- 更新时间
    CONSTRAINT conn_service_header_out_pkey PRIMARY KEY (header_id)
);
COMMENT ON TABLE conn_service_header_out IS '能力服务响应头';

COMMENT ON COLUMN conn_service_header_out.header_id IS '响应头主键';
COMMENT ON COLUMN conn_service_header_out.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_service_header_out.service_id IS '服务id';
COMMENT ON COLUMN conn_service_header_out.service_version IS '服务版本';
COMMENT ON COLUMN conn_service_header_out.node_type IS '节点类型[string=字符串,long=整数,decimal=小数]';
COMMENT ON COLUMN conn_service_header_out.node_name IS '英文字段名';
COMMENT ON COLUMN conn_service_header_out.node_label IS '字段中文描述';
COMMENT ON COLUMN conn_service_header_out.node_neededable IS '节点是否必填[y=是,n=否]';
COMMENT ON COLUMN conn_service_header_out.create_by IS '创建者';
COMMENT ON COLUMN conn_service_header_out.create_time IS '创建时间';
COMMENT ON COLUMN conn_service_header_out.update_by IS '更新者';
COMMENT ON COLUMN conn_service_header_out.update_time IS '更新时间';

create sequence seq_conn_service_param_in start with 1000000 increment by 1;

CREATE TABLE conn_service_param_in (
    node_id bigint NOT NULL, -- 节点id
    service_ver_id bigint NULL, -- 服务版本主键
    service_id bigint NOT NULL, -- 服务id
    service_version varchar(16) DEFAULT '', -- 服务版本
    node_parent_id bigint NOT NULL, -- 父节点id
    node_type varchar(8) DEFAULT 'string' NOT NULL, -- 节点类型[string=字符串,long=整数,decimal=小数,object=对象,array=数组]
    node_name varchar(32) DEFAULT '' NOT NULL, -- 英文字段名
    node_label varchar(32) NULL, -- 字段中文描述
    node_neededable char(1) DEFAULT 'Y' NOT NULL, -- 节点是否必须[y=是,n=否]
    node_valueable char(1) DEFAULT 'Y' NOT NULL, -- 节点是否必填[y=是,n=否]
    node_check_regex varchar(128) DEFAULT '', -- 字段值校验正则表达式
    is_attr char(1) DEFAULT 'N' NULL, -- 节点是否属性[y=是,n=否]
    create_by varchar(64) DEFAULT '', -- 创建者
    create_time timestamp(6) NULL, -- 创建时间
    update_by varchar(64) DEFAULT '', -- 更新者
    update_time timestamp(6) NULL, -- 更新时间
    CONSTRAINT conn_service_param_in_pkey PRIMARY KEY (node_id)
);
COMMENT ON TABLE conn_service_param_in IS '能力服务入参';

COMMENT ON COLUMN conn_service_param_in.node_id IS '节点id';
COMMENT ON COLUMN conn_service_param_in.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_service_param_in.service_id IS '服务id';
COMMENT ON COLUMN conn_service_param_in.service_version IS '服务版本';
COMMENT ON COLUMN conn_service_param_in.node_parent_id IS '父节点id';
COMMENT ON COLUMN conn_service_param_in.node_type IS '节点类型[string=字符串,long=整数,decimal=小数,object=对象,array=数组]';
COMMENT ON COLUMN conn_service_param_in.node_name IS '英文字段名';
COMMENT ON COLUMN conn_service_param_in.node_label IS '字段中文描述';
COMMENT ON COLUMN conn_service_param_in.node_neededable IS '节点是否必须[y=是,n=否]';
COMMENT ON COLUMN conn_service_param_in.node_valueable IS '节点是否必填[y=是,n=否]';
COMMENT ON COLUMN conn_service_param_in.node_check_regex IS '字段值校验正则表达式';
COMMENT ON COLUMN conn_service_param_in.is_attr IS '节点是否属性[y=是,n=否]';
COMMENT ON COLUMN conn_service_param_in.create_by IS '创建者';
COMMENT ON COLUMN conn_service_param_in.create_time IS '创建时间';
COMMENT ON COLUMN conn_service_param_in.update_by IS '更新者';
COMMENT ON COLUMN conn_service_param_in.update_time IS '更新时间';

create sequence seq_conn_service_param_out start with 1000000 increment by 1;

CREATE TABLE conn_service_param_out (
    node_id bigint NOT NULL, -- 节点id
    service_ver_id bigint NULL, -- 服务版本主键
    service_id bigint NOT NULL, -- 服务id
    service_version varchar(16) DEFAULT '', -- 服务版本
    node_parent_id bigint NOT NULL, -- 父节点id
    node_type varchar(8) DEFAULT 'string' NOT NULL, -- 节点类型[string=字符串,long=整数,decimal=小数,object=对象,array=数组]
    node_name varchar(32) DEFAULT '' NOT NULL, -- 英文字段名
    node_label varchar(32) NULL, -- 字段中文描述
    node_neededable char(1) DEFAULT 'Y' NOT NULL, -- 节点是否必须[y=是,n=否]
    is_attr char(1) DEFAULT 'N' NULL, -- 节点是否属性[y=是,n=否]
    create_by varchar(64) DEFAULT '', -- 创建者
    create_time timestamp(6) NULL, -- 创建时间
    update_by varchar(64) DEFAULT '', -- 更新者
    update_time timestamp(6) NULL, -- 更新时间
    CONSTRAINT conn_service_param_out_pkey PRIMARY KEY (node_id)
);
COMMENT ON TABLE conn_service_param_out IS '能力服务出参';

COMMENT ON COLUMN conn_service_param_out.node_id IS '节点id';
COMMENT ON COLUMN conn_service_param_out.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_service_param_out.service_id IS '服务id';
COMMENT ON COLUMN conn_service_param_out.service_version IS '服务版本';
COMMENT ON COLUMN conn_service_param_out.node_parent_id IS '父节点id';
COMMENT ON COLUMN conn_service_param_out.node_type IS '节点类型[string=字符串,long=整数,decimal=小数,object=对象,array=数组]';
COMMENT ON COLUMN conn_service_param_out.node_name IS '英文字段名';
COMMENT ON COLUMN conn_service_param_out.node_label IS '字段中文描述';
COMMENT ON COLUMN conn_service_param_out.node_neededable IS '节点是否必须[y=是,n=否]';
COMMENT ON COLUMN conn_service_param_out.is_attr IS '节点是否属性[y=是,n=否]';
COMMENT ON COLUMN conn_service_param_out.create_by IS '创建者';
COMMENT ON COLUMN conn_service_param_out.create_time IS '创建时间';
COMMENT ON COLUMN conn_service_param_out.update_by IS '更新者';
COMMENT ON COLUMN conn_service_param_out.update_time IS '更新时间';

create sequence seq_conn_service_version start with 1000000 increment by 1;

CREATE TABLE conn_service_version (
    service_ver_id bigint NOT NULL, -- 服务版本主键
    service_id bigint NOT NULL, -- 服务id
    service_version varchar(16) DEFAULT '', -- 服务版本
    service_ver_desc varchar(512) DEFAULT '', -- 服务版本说明
    service_ver_status char(1) DEFAULT '1' NULL, -- 服务状态[0=生效,1=暂存,2=停用,7=驳回,8=审批中,9=作废]
    servicei_ver_start_time timestamp(6) NULL, -- 版本启用时间
    service_ver_end_time timestamp(6) NULL, -- 版本停用时间（根据启停时间定时更新版本状态）
    wsdl_content_id bigint NULL, -- wsdl内容主键
    wsdl_url varchar(512) NULL, -- wsdl地址（主版本同时发布带版本号和不带版本号的两个服务url）
    jms_datasource_code varchar(32) DEFAULT '', -- jms数据源编码
    jms_type varchar(16) DEFAULT '', -- jms类型[topic=topic,queue=queue]
    jms_destination_name varchar(64) DEFAULT '', -- jms消息目标名称
    jms_role char(1) DEFAULT 'C' NULL, -- jms角色[p=生产者,c=消费者]
    create_by varchar(64) DEFAULT '', -- 创建者
    create_time timestamp(6) NULL, -- 创建时间
    update_by varchar(64) DEFAULT '', -- 更新者
    update_time timestamp(6) NULL, -- 更新时间
    http_request_method varchar(8) NULL, -- 请求方式
    route_content_id bigint NULL, -- 路由内容主键
    inparam_with_attr char(1) DEFAULT 'N' NOT NULL, -- 带属性入参[y=是,n=否]
    outparam_with_attr char(1) DEFAULT 'N' NOT NULL, -- 带属性出参[y=是,n=否]
    test_pass_status char(1) NULL, -- 测试通过状态[0=未通过,1=通过]
    perm_type varchar(255) NULL,
    CONSTRAINT conn_service_version_pkey PRIMARY KEY (service_ver_id)
);
CREATE INDEX idx_service_id ON conn_service_version(service_id);
COMMENT ON TABLE conn_service_version IS '能力服务版本';

COMMENT ON COLUMN conn_service_version.service_ver_id IS '服务版本主键';
COMMENT ON COLUMN conn_service_version.service_id IS '服务id';
COMMENT ON COLUMN conn_service_version.service_version IS '服务版本';
COMMENT ON COLUMN conn_service_version.service_ver_desc IS '服务版本说明';
COMMENT ON COLUMN conn_service_version.service_ver_status IS '服务状态[0=生效,1=暂存,2=停用,7=驳回,8=审批中,9=作废]';
COMMENT ON COLUMN conn_service_version.servicei_ver_start_time IS '版本启用时间';
COMMENT ON COLUMN conn_service_version.service_ver_end_time IS '版本停用时间（根据启停时间定时更新版本状态）';
COMMENT ON COLUMN conn_service_version.wsdl_content_id IS 'wsdl内容主键';
COMMENT ON COLUMN conn_service_version.wsdl_url IS 'wsdl地址（主版本同时发布带版本号和不带版本号的两个服务url）';
COMMENT ON COLUMN conn_service_version.jms_datasource_code IS 'jms数据源编码';
COMMENT ON COLUMN conn_service_version.jms_type IS 'jms类型[topic=topic,queue=queue]';
COMMENT ON COLUMN conn_service_version.jms_destination_name IS 'jms消息目标名称';
COMMENT ON COLUMN conn_service_version.jms_role IS 'jms角色[p=生产者,c=消费者]';
COMMENT ON COLUMN conn_service_version.create_by IS '创建者';
COMMENT ON COLUMN conn_service_version.create_time IS '创建时间';
COMMENT ON COLUMN conn_service_version.update_by IS '更新者';
COMMENT ON COLUMN conn_service_version.update_time IS '更新时间';
COMMENT ON COLUMN conn_service_version.http_request_method IS '请求方式';
COMMENT ON COLUMN conn_service_version.route_content_id IS '路由内容主键';
COMMENT ON COLUMN conn_service_version.inparam_with_attr IS '带属性入参[y=是,n=否]';
COMMENT ON COLUMN conn_service_version.outparam_with_attr IS '带属性出参[y=是,n=否]';
COMMENT ON COLUMN conn_service_version.test_pass_status IS '测试通过状态[0=未通过,1=通过]';

create sequence seq_conn_sorth_intf_log start with 1000000 increment by 1;

CREATE TABLE conn_sorth_intf_log (
    sorth_intf_log_id bigint NOT NULL, -- 主键id
    service_code varchar(64) NULL, -- 接口编码
    biz_code varchar(64) NULL, -- 业务编码
    sorth_in_params text NULL, -- 南向上传接口发送的参数
    out_xml_params text NULL, -- 开放互联消费者根据规则转成xml的参数
    xml_to_json text NULL, -- 转换后的xml 转成 json，作为 dcoos 接口的 入参
    dcoos_retrun_msg text NULL, -- dcoos 接口返回的信息
    json_to_xml text NULL, -- dcoos 返回的json  根据规则 转 xml
    invoke_dcoos_time timestamp(6) NULL, -- 调用dcoos时间
    error_msg text NULL, -- 错误信息
    status char(1) NULL, -- 状态[1=成功,2=失败]
    CONSTRAINT conn_sorth_intf_log_pkey PRIMARY KEY (sorth_intf_log_id)
);
COMMENT ON TABLE conn_sorth_intf_log IS '南向上传：接口日志表';

COMMENT ON COLUMN conn_sorth_intf_log.sorth_intf_log_id IS '主键id';
COMMENT ON COLUMN conn_sorth_intf_log.service_code IS '接口编码';
COMMENT ON COLUMN conn_sorth_intf_log.biz_code IS '业务编码';
COMMENT ON COLUMN conn_sorth_intf_log.sorth_in_params IS '南向上传接口发送的参数';
COMMENT ON COLUMN conn_sorth_intf_log.out_xml_params IS '开放互联消费者根据规则转成xml的参数';
COMMENT ON COLUMN conn_sorth_intf_log.xml_to_json IS '转换后的xml 转成 json，作为 dcoos 接口的 入参';
COMMENT ON COLUMN conn_sorth_intf_log.dcoos_retrun_msg IS 'dcoos 接口返回的信息';
COMMENT ON COLUMN conn_sorth_intf_log.json_to_xml IS 'dcoos 返回的json  根据规则 转 xml';
COMMENT ON COLUMN conn_sorth_intf_log.invoke_dcoos_time IS '调用dcoos时间';
COMMENT ON COLUMN conn_sorth_intf_log.error_msg IS '错误信息';
COMMENT ON COLUMN conn_sorth_intf_log.status IS '状态[1=成功,2=失败]';